package com.syty.demo.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.sql.Date;

@Api(tags = "数据插入",value = "对domain-user实体类的字段createdTime进行创建并处理")
@Component
public class domainPropertyHandler implements MetaObjectHandler {

    @ApiOperation(value = "创建获取当前时间，并且插入到实体类的createdTime字段上")
    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("createdTime",new Date(System.currentTimeMillis()),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
